package wysiwyg.client.widgets;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.widget.core.client.info.Info;
import com.sencha.gxt.widget.core.client.menu.Item;
import com.sencha.gxt.widget.core.client.menu.MenuItem;

public class MenuBarWidghet extends Composite {

	@UiTemplate("MenuBarWidghet.ui.xml")
	interface MyUiBinder extends UiBinder<Widget, MenuBarWidghet> {
	}

	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

	public MenuBarWidghet() {
		initWidget(uiBinder.createAndBindUi(this));
	}
 
	@UiHandler(value = { "newFile", "openFile", "importFile", "exportFile",
			"help", "about", "license" })
	public void onMenuSelection(SelectionEvent<Item> event) {
		MenuItem item = (MenuItem) event.getSelectedItem();
		Info.display("Action", "You selected the " + item.getText());
	}

}
